package school;

public class Student {
	private String name;
	private final String sex;// 一定要在构造方法中赋值
	private int age;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public String getSex() {
		return sex;
	}

	// public void setSex(String s) {
	// sex = s;
	// }

	public Student(String name) {
		// super();
		// this.name = name;
		// sex = "男";

		this(name, "男", 0);
		System.out.println("一个参数的构造方法");
	}

	public Student(String name, String sex, int age) {
		super();
		this.name = name;
		this.sex = sex;
		this.age = age;
		System.out.println("三个参数的构造方法");
	}

	@Override
	public String toString() {
		return "Student [name=" + name + ", sex=" + sex + ", age=" + age + "]";
	}

	public static void main(String[] args) {
		double d = 3.0d;
		Student s = new Student("陈哲", "男", 22);
		// s.sex = "妖";
		System.out.println(s);
	}
}
